package com.bat.feign.client.controller;

import com.alibaba.fastjson.JSONObject;
import com.bat.feign.TestFeign;
import com.bat.feign.vo.res.TestResVo;
import com.bat.util.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: eureka-server
 * @description:
 * @author: zhoupengfei
 * @create: 2019-09-12 16:20
 **/
@RestController
@Slf4j
@Api("feign测试")
@Validated
@RequestMapping("/")
public class FeignController {
    @Autowired
    public TestFeign testFeign;

    @ApiOperation("测试feign")
    @RequestMapping(value = "/testFeign",method = RequestMethod.GET)
    public R<TestResVo> index(){
        TestResVo testResVo=testFeign.testFeign().getData();
        log.info("feign返回值,{}", JSONObject.toJSONString(testResVo));
        return R.s(testResVo);
    }
}